package com.waves.task.domain.enums;

/**
 * @author dlw
 * @date 2024/09/28
 **/

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

@AllArgsConstructor
@Getter
public enum TaskTypeEnum {
    // 任务类型
    // 0普通贴 1赏金贴 2求助贴 3个人或他人主页贴 4个人或他人评论贴
    // 5热门贴 6收藏贴 7关注贴 8图片贴 9视频贴 10附近征召
    TASK_TYPE_COMMON(0, "普通帖"),
    TASK_TYPE_BOUNTY(1, "赏金贴"),
    TASK_TYPE_HELP(2, "求助帖"),
    TASK_TYPE_HOME(3, "主页贴"),
    TASK_TYPE_COMMENT(4, "评论贴"),
    TASK_TYPE_HOT(5, "热门贴"),
    TASK_TYPE_COLLECT(6, "收藏贴"),
    TASK_TYPE_FOLLOW(7, "关注贴"),
    TASK_TYPE_IMG(8, "图片贴"),
    TASK_TYPE_VIDEO(9, "视频贴"),
    TASK_TYPE_NEAR(10, "附近征召"),
    ;

    private final Integer type;
    private final String desc;

    public static String getEnumByCode(Integer code) {
        return Arrays.stream(TaskTypeEnum.values())
                .filter(f -> Objects.equals(f.getType(), code))
                .findFirst()
                .get()
                .getDesc();
    }
}
